Hardware Architecture of My IoT-Based Single-Socket kWh Energy Monitoring System
Monitoring electrical energy consumption at the socket level provides valuable insight into real-time power usage, cost estimation, and load behavior. In this project, I designed a single-socket IoT-based kWh monitoring system capable of measuring voltage, current, power, and accumulated energy, while transmitting data over WiFi for remote monitoring.
This first version focuses on a compact single-output architecture using ESP32 and a PZEM-based energy measurement module.

System Overview
The hardware consists of the following main blocks:
- ESP32 microcontroller (main controller with WiFi)
- PZEM-004T energy measurement module
- AC-DC power supply (220VAC to 5VDC)
- High-power relay for load control
- LCD 16x2 display for local monitoring
- Terminal block for AC input/output
The internal board layout and power separation can be seen in the device assembly documentation:

Energy Measurement Module
For accurate measurement of voltage, current, power, and accumulated energy (kWh), I used the PZEM-004T module. This module simplifies high-voltage measurement because it provides built-in isolation between the AC line and the low-voltage microcontroller side.
Key specifications include:
- Voltage measurement up to 260VAC
- Current measurement up to 100A (using CT)
- Frequency range 45–65Hz
Using a dedicated metering module reduces ADC complexity and improves reliability compared to raw analog sensing.
Power Supply and Isolation
The system operates from a 220VAC input. A compact AC-DC converter module steps down the voltage to 5VDC, which powers the ESP32, relay driver, and LCD.
Important hardware considerations:
- Clear separation between high-voltage AC section and low-voltage logic section
- Proper terminal block insulation
- Short wiring between PSU and ESP32
- Adequate spacing to reduce electrical noise
Even in prototype form (matrix board), I ensured physical separation between AC terminals and control circuitry to minimize risk and interference.
Load Control Section
A high-power relay is used to control the socket output. The relay allows:
- Remote ON/OFF switching
- Automatic cut-off based on energy limit
- Integration with IoT platforms for smart control
The relay driver circuit includes proper transistor switching and flyback protection to ensure ESP32 safety.
Local Monitoring Interface
A 16x2 LCD is used to display:
- Voltage (V)
- Current (A)
- Power (W)
- Energy (kWh)

This ensures the device remains functional even without internet connectivity.
Design Lessons
Designing an AC-powered IoT device requires careful attention to isolation, grounding, and layout discipline. Even small wiring mistakes can introduce noise into measurement readings.
Although this version was built as a prototype, migrating to a properly manufactured PCB would significantly improve safety, signal integrity, and long-term reliability.
This single-socket design became the foundation for more advanced multi-socket and cloud-integrated versions developed later.
#Embedded# #ESP32# #PZEM# #Energy Monitor#
Sign In Or Register Comment after
No comments yet. Be the first to comment!